const router = require('koa-router')()
const userCtrl = require('../controllers/userCtrl.js')
const projCtrl = require('../controllers/projCtrl')
const resuCtrl = require('../controllers/resumeCtrl')

const {
  verifyParams,
  verifyUserID,
  verifyResumParams,
  verifyaddProjParams,
  verifyPiD,
  verifyPoint,
  verifyUserAndProjID,
  verifydeliver,
  verifydeliverStatus,
  verifysendFeedback
} = require('../middleware/verify.params')

router.get('/', async (ctx, next) => {
  await ctx.render('index', {
    title: 'users 路由菜单'
  })
})

router.post('/burryPoint',verifyPoint, projCtrl.burryPoint) // 埋点请求+1，收藏+5，投递加10

router.get('/getUserinfo', verifyUserID,userCtrl.getUserinfo)

router.get('/getContact', verifyUserID,userCtrl.getContact) // 获取用户联系方式 参数userId

router.post('/updateResume',verifyResumParams, userCtrl.editResume)

// router.post('/updateBaseinfo', verifyParams, userCtrl.updateBaseinfo)

router.post('/sendFeedback',verifysendFeedback, userCtrl.sendFeedback)

router.post('/addproj', verifyaddProjParams, projCtrl.addproj)

router.post('/deletCollet', projCtrl.deletCollet)

router.post('/deleteproj', verifyPiD,projCtrl.deleteproj)

router.post('/collcetProj', verifyUserAndProjID,projCtrl.collctProj)

router.post('/collectStatus',verifyUserAndProjID ,projCtrl.collectStatus) // 收藏状态

router.get('/projDetail', verifyPiD,projCtrl.projDetail)

router.get('/collectList', verifyUserID,projCtrl.collectList)

router.get('/myProjlist',verifyUserID, projCtrl.myProjlist)

router.get('/receResulist',verifyUserID, resuCtrl.receResu)

router.get('/deliverResulist', verifyUserID, resuCtrl.deliverResu)

router.post('/sendResume', verifydeliver,resuCtrl.sendResume)

router.post('/sendReStatus',verifydeliverStatus, resuCtrl.sendReStatus) // 投递状态

router.post('/updateResuStatus', resuCtrl.updateResuStatus)

router.post('/resuStatus', resuCtrl.resuStatus) // 查看进度

router.post('/deleteDeliver', resuCtrl.deleteDeliver) 



/**
 * 
 * @api {post} /user/burryPoint 埋点
 * @apiName 埋点
 * @apiGroup 发布管理
 * @apiVersion  1.0.1
 * 
 * @apiParam  {String} projId 项目id
 * @apiParam  {Number} num 曝光数
 * 
 * 
 * @apiParamExample  {type} Request-Example:
 * {
 *     projId : '1',
 *     num:1
 * }
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 * {
 *     look : 1
 * }
 * 
 * 
 */

/**
 * 
 * @api {post} /users/deleteDeliver 删除投递信息
 * @apiName 删除投递信息
 * @apiGroup 投递信息
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {String} paramName description

 * {
 *     _id : 5
 * }
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
  {
      "code": 0,
      "msg": "success"
  }
 * 
 * 
 */

/**
 * 
 * @api {post} /users/sendFeedback  反馈
 * @apiName 反馈
 * @apiGroup 用户
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {number} userId 用户id
 * @apiParam  {String} info 信息
 * 
 * @apiParamExample  {type} Request-Example:
 *    {
 *        "userId": "23",
 *        "info": "2423"
 *    }
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 *    {
 *        "code": 0,
 *        "msg": "success"
 *    }
 * 
 * 
 */
/**
 * 
 * @api {post} /users/updateResuStatus 更新投递状态
 * @apiName 更新投递状态
 * @apiGroup 投递信息
 * @apiVersion  1.0.1
 * 
 * @apiParam  {number} _id 投递信息id
 * @apiParam  {number} status 状态
 * @apiParam  {string} reason 拒绝原因
 * 
 * 
 * 
 * @apiParamExample  {type} Request-Example:
 *    {
 *        "reason": '',
 *        "_id": "1",
 *        "status": "3", //0未读，1已读，2已联系，3已拒绝
 *    }
 * 
 * @apiSuccessExample {type} Success-Response:
 *  {
 *      "code": 0,
 *      "msg": "success"
 *  }
 * 
 * 
 */
/**
 * 
 * @api {post} /users/sendResume 投递简历
 * @apiName 投递简历
 * @apiGroup 投递信息
 * @apiVersion 1.0.1
 * 
 * 
 * @apiParam  {string} senderId 投递方id
 * @apiParam  {string} reciverId 接收方id
 * @apiParam  {string} projId 项目id
 * @apiParam  {string} contact 联系方式
 * 
 * 
 * 
 * @apiParamExample  {type} Request-Example:
 *     {    
 *         "contact":'',
 *         "senderId": "3",
 *         "projId": "3",
 *         "reciverId": "3"
 *     }
 * 
 * @apiSuccessExample {type} Success-Response:
 *    {
 *        "code": 0,
 *        "msg": "success"
 *    }
 * 
 * 
 */


/**
 * 
 * @api {post} /users/collctProj 收藏项目
 * @apiName 收藏项目
 * @apiGroup 收藏管理
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {number} userId 用户id
 * @apiParam  {number} projId 项目id

 * 
 * @apiParamExample  {type} Request-Example:
 * {
 *     userId : 323,
 *     projId : 232
 * }
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 * {
 *     property : value
 * }
 * 
 * 
 */
/**
 * 
 * @api {post} /users/deletCollet 删除收藏
 * @apiName 删除收藏
 * @apiGroup 收藏管理
 * @apiVersion  1.0.1
 * 
 * @apiParam  {number} collectId 收藏id
 * 
 * @apiSuccessExample {type} Success-Response:
 * {
 *     "msg": "success",
 *      "code": 0,
 * }
 * 
 * 
 */
/**
 * 
 * @api {get} /uses/collectList 获取收藏列表
 * @apiName 获取收藏列表
 * @apiGroup 收藏管理
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {number} userId 用户id
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 *    {
 *        "code": 0,
 *        "msg": "success",
 *        "data": [
 *            {
 *                "collectId":'2', // 收藏的id
 *                "projName": "2234",
 *                "projId": 2,
 *                "createTime": "",
 *            }
 *        ]
 *    }
 * 
 * 
 */


/**
 * 
 * @api {get} /users/myProjlist 我发布的项目列表
 * @apiName 我发布的项目列表
 * @apiGroup 发布管理
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {String} userId 用户id
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 *    {
 *        "code": 0,
 *        "msg": "success",
 *        "data": [
 *            {
 *                "projName": "3p",
 *                "projId": 3,
 *                 "createTime":'',
 *                "mark": 0, // 0待审核，1已审核
 *             
 *            },
 *        ]
 *    }
 * 
 * 
 */
/**
 * 
 * @api {get} /users/projDetail 项目详情
 * @apiName 项目详情
 * @apiGroup 发布管理
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {String} projId 项目id
 * 
 * @apiSuccessExample {type} Success-Response:
 *     {
 *         "code": 0,
 *         "msg": "success",
 *         "data": {
 *             "userId": 3
 *             "avatarUrl": "qew",
 *             "nickName": "ds", // 发布人
 *             "grade": "2009", // 项目限制年级
 *             "department": "政法学院", // 项目限制学院
 *             "commNum": 3, // 评论人数
 *             "projName": "2234",
 *             "projDesc": "asdd",
 *             "createTime": "2022-11-19T10:21:02.000Z",
 *             "num": 6  ///人数
 *         }
 *     }
 * 
 * 
 */

/**
 * 
 * @api {get} /users/deliverResulist 获取投递列表
 * @apiName 获取投递列表
 * @apiGroup 投递信息
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {String} userId 当前登录用户的id
 * 
 * 
 * @apiParamExample  {type} Request-Example:
 * {
 *      userId : 12
 * }
 * 
 * @apiSuccessExample {type} Success-Response:
 *    {
 *        "code": 0,
 *        "msg": "success",
 *        "data": [
 *            {
 *                "_id": 4,
 *                "status": "0", 
 *                "createTime": "2022-11-20T06:31:54.000Z", // 投递时间
 *                    "num": 1,
 *                    "projName": "3p",
 *                    "projId": 3
 *                
 *            },
 *        ]
 *    }
 * 
 * 
 */

/**
 * 
 * @api {get} /uses/receResulist 获取已收投递列表
 * @apiName 获取已收投递列表
 * @apiGroup 投递信息
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {String} userId 当前登录用户的id
 * 
 * @apiParamExample  {type} Request-Example:
 * {
 *     userId : 12
 * }
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 *{
 *    "code": 0,
 *    "msg": "success",
 *    "data": [
 *        {
 *            "_id": 1, 
 *            "status": "0", // 状态 0 未查看，1 已查看，3 已拒绝 ， 2已联系
 *            "createTime": "2022-11-20T06:22:03.000Z", // 投递时间
 *            // 投递者信息
 *                "nickName": "2号",
 *                "avatarUrl": "2号",
 *                "userId": 2
 *                "num": 1,
 *                "projName": "3p",
 *            
 *        },
 *    ]
 * }
 * 
 */

module.exports = router
/**
 * 
 * @api {post} /users/deleteproj 删除发布
 * @apiName 删除发布
 * @apiGroup 发布管理
 * @apiVersion  1.0.1
 * 
 * @apiParam  {number} projId 项目id
 * 
 * @apiParamExample  {type} Request-Example:
 * {
 *     "projId" : 3232
 * }
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 *    {
 *        "code": 0,
 *        "msg": "success"
 *    }
 * 
 * 
 */
/**
 * 
 * @api {post} /users/addproj 发布项目
 * @apiName 发布项目
 * @apiGroup 发布管理
 * @apiVersion  1.0.1
 * 
 * 
 * @apiParam  {String} sortId 分类id
 * @apiParam  {String} userId 用户id
 * @apiParam  {String} schoolId 学校id
 * @apiParam  {String} department 学院id
 * @apiParam  {String} projName 项目名称
 * @apiParam  {String} projDesc 项目描述
 * @apiParam  {Number} num 人数
 * @apiParam  {String} grade 年级
 * 
 * @apiParamExample  {type} Request-Example:
 *  {
 *    "sortId": "1",
 *    "grade":"",
 *    "userId":"23",
 *    "schoolId":"1",
 *    "department":"",
 *    "num":"2",
 *    "projDesc":"",
 *    "projName":""
 *  }
 * 
 * 
 * @apiSuccessExample {type} Success-Response:
 *     {
 *         "code": 0,
 *         "msg": "success"
 *     }
 * 
 * 
 */


/**
 * 
 * @api {post} /uses/updateResume 更新简历信息
 * @apiName 更新简历信息
 * @apiGroup 用户
 * @apiVersion  1.0.1
 * 
 * @apiParam  {String} grade 年级
 * @apiParam  {String} nickName 昵称
 * @apiParam  {String} department 院系
 * @apiParam  {Number} schoolId 学校
 * @apiParam  {Number} gender 性别
 * @apiParam  {Number} userId 简历id
 * @apiParam  {String} skills 技能
 * @apiParam  {String} selfdesc 自我评价
 * @apiParam  {String} exp 经历
 * 
 * @apiParamExample  {type} Request-Example:
 *
 *  {
 *    "exp":"",
 *    "skills": "",
 *    "selfdesc": "",
 *    "userId": 2,
 *    "schoolId": 1,
 *    "gender":1
 *    "grade": "2022",
 *    "nickName": '',
 *    "department":"",
 *  }
 * 
 * @apiSuccessExample {type} Success-Response:
 * {
 *    "code": 0,
 *    "msg": "success"
 * }
 * 
 * 
 */
/**
 * 
 * @api {get} /users/getUserinfo/:userId 获取用户信息
 * @apiName 获取用户信息
 * @apiGroup 用户
 * @apiVersion  1.0.1
 * 
 * @apiParam  {Number} userId 用户id
 * 
 * @apiSuccessExample {type} Success-Response: *
 *
 *    {
 *        "code": 0,
 *        "msg": "success",
 *        "data": {
 *            "avatarUrl": "2号",
 *            "nickName": "2号",
 *            "gender": 1,
 *            "grade": "2002",
 *            "selfdesc": "2",
 *            "skills": "2",
 *            "exp": "2",
 *            "depName": "政法学院",
 *            "department": "2",
 *            "schoolId": 1,
 *            "schoolName": "学校不限"
 *        }
 *    }
 * 
 */